<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head>
<body>
    <ul id="ul1">
        <li>li01</li>
        <li>li02</li>
        <li>li03</li>
        <li>li04</li>
        <li>li05</li>
    </ul>
    <ul id="ul2">
        <li>li01</li>
        <li>li02</li>
        <li>li03</li>
        <li>li04</li>
        <li>li05</li>
        <li>li06</li>
    </ul>
    <script>
        // call、apply、bind是ES5中在函数调用时候限定（修改）函数中this的指向
        // 函数.call(调用者,参数);
        var user={
            name:"小金金"
        };
        function show(){
            console.log(this);
        }

        show();
        show.call(user);
        show.call(["alice","baby","cici"]);
        // call方法中将基本数据类型转换成引用数据类型 "abc" => new String("abc")
        show.call(123);
        show.call("abc");

        function show2(a,b){
            console.log(this);
            console.log(a);
            console.log(b);
        }
        show2.call(user,"嘿嘿，我是参数1","嘻嘻，我是参数2");
        let ul1=document.getElementById("ul1");
        let ul2=document.getElementById("ul2");
        let lis1=ul1.children;
        let lis2=ul2.children;
        // console.log(lis1);
        // console.log(lis2);
        // lis1.concat(lis2);//lis1不是数组，所以不能使用concat方法
        var arrs=Array.prototype.concat.call(lis1,lis2);
        console.log(arrs);

        var arrays=[];
       
        for(var i=0;i<lis1.length;i++){
            arrays.push(lis1[i]);
        }
        for(var i=0;i<lis2.length;i++){
            arrays.push(lis2[i]);
        }
        console.log(arrays);
        // var arr1=[1,2,3];
        // var arr2=[11,22,33];      
        // var arrs3=arr1.concat(arr2);  
        // console.log(arrs3);

        Array.prototype.forEach.call(lis1,function(value,index){
            console.log(value);
        });

       

    </script>
</body>
</html>